Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
Why my subdirectory "/game" of the react website cannot be served from nginx?

I have a website with has one subdirectory named "/game". There is no problem when I click the tab in navbar when I execute the website in localhost (localhost:3000/game is working!). But when I want to access using my domain address, it gives me error "404 The requested page was not found." (mydomain/game is not working!)

What am I missing?

React Part - Navbar.js :

...

<a href="/game">
  <span>Game</span>
</a>

...

React Part - Game.js :

import React, { Component } from 'react'

export default class Game extends Component {
    render() {
        return (
            <div className='text-white text-center game'>
                GAME INFORMATION
            </div>
        )
    }
}

React Part - App.js :

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route path="/" element={
          <div className="App">
            <header className='Main-header'>
              <Navbar />
              <Hero />
            </header>
            <About />
            <Gallery />
            <Faq />
          </div>
        } />
        <Route path="/game" element={<Game />} />
      </Routes>
    </BrowserRouter>
  );
}

export default App;

Nginx Part, after typing vi default :

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        server_name _;

        location / {
                proxy_pass http://localhost:3000;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Probably just an ssl error. Try to get a certificate from letsencrypt.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda